package cvsexercise2;

public class BasicArray {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		/* Output a start message to the console */
		System.out.println("Exercise 2 - Basic Arrays started");
		
		/* Declare and initialize an array of 5 integers (10, 25, 100, 75, 90)
		   Use an array initializer list to populate the array */
		int[] myNumbersArray = {10, 25, 100, 75, 90};
		
		/* Use the array's length property to output the length of the array */
		int nLength = myNumbersArray.length;
		System.out.println("Length of myNumbersArray[] = " + nLength);
		
		/* Write out each value stored in the array */
		System.out.println("myNumbersArray[0] = " + myNumbersArray[0]);
		System.out.println("myNumbersArray[1] = " + myNumbersArray[1]);
		System.out.println("myNumbersArray[2] = " + myNumbersArray[2]);
		System.out.println("myNumbersArray[3] = " + myNumbersArray[3]);
		System.out.println("myNumbersArray[4] = " + myNumbersArray[4]);
		
		/* Sum all of the values in the array */
		int nResult = 0;
		nResult += myNumbersArray[0];
		nResult += myNumbersArray[1];
		nResult += myNumbersArray[2];
		nResult += myNumbersArray[3];
		nResult += myNumbersArray[4];
		
		/* Output the summation to the console */
		System.out.println("Summation of myNumbersArray = " + nResult);
		
		/* Output a completed message to the console */
		System.out.println("Exercise 2 - Basic Arrays completed");
	}
}
